//
//  JYMacro.swift
//  JYCalculate
//
//  Created by 何治军 on 2018/10/26.
//  Copyright © 2018 何治军. All rights reserved.
//

import UIKit

let SCREENW = UIScreen.main.bounds.width
let SCREENH = UIScreen.main.bounds.height

func JYColorWithRGB(_ r: CGFloat , g:CGFloat , b:CGFloat ,a:CGFloat) -> UIColor {
    return UIColor(
        red: r / 255.0,
        green: g / 255.0,
        blue: b / 255.0,
        alpha: a
    )
}

func JYColorWithHex(hex: uint,a:CGFloat) -> UIColor {
    return UIColor(
        red: CGFloat((hex & 0xFF0000) >> 16) / 255.0,
        green: CGFloat((hex & 0x00FF00) >> 8) / 255.0,
        blue: CGFloat(hex & 0x0000FF) / 255.0,
        alpha: a
    )
}

let JYNavigationBarColor         = JYColorWithRGB(108,g: 93,b: 38,a: 1)
let JYVCBackGroundColor          = JYColorWithRGB(248,g: 248,b: 248,a: 1)
let JYVCGrayBackGroundColor      = JYColorWithRGB(240,g: 240,b: 240,a: 1)
let JYButtonColor                = JYColorWithRGB(243,g: 244,b: 244,a: 1)
let JYButtonTitleColor           = JYColorWithRGB(69,g: 72,b: 75,a: 1)
let JYDetailRedColor             = JYColorWithHex(hex: 0xfa5645, a: 1)
let JYDetailGrayColor            = JYColorWithHex(hex: 0x888888, a: 1)
let JYSeparatorLineColor         = JYColorWithHex(hex: 0xbbbbbb, a: 1)

/// 语言本地化
///
/// - Parameter k: 键
/// - Returns: <#return value description#>
func Localized(_ k:String)->String {
    return (Bundle(path: Bundle.main.path(forResource: UserDefaults.standard.object(forKey: "appLanguage") as? String, ofType: "lproj")!)?.localizedString(forKey: k, value: nil, table: "language"))!
}


let CaculateAppKey = "f964f0ecab39c3356daf8d069c5312e5"
let KResponseBody  = "body"
